package com.koron.css2.newProjectCenter.impl;

import com.koron.css2.ServerInterface;
import com.koron.css2.newProjectCenter.bean.PubUpInvoice;
import com.koron.css2.newProjectCenter.mapper.PjPubUpInvoiceMapper;
import com.koron.css2.serviceManage.bean.RequestBean;
import com.koron.css2.serviceManage.bean.UserInfoBean;
import com.koron.css2.serviceManage.utils.JsonUtils;
import com.koron.util.Constant;
import org.koron.ebs.mybatis.SessionFactory;
import org.swan.bean.MessageBean;

/**
 * @Author: 苏小龙
 * @CreateTime: 2024-12-03
 * @Description: 开票及到账确认
 * @Version: 1.0
 */
public class PjPubUpInvoiceuUpdate implements ServerInterface {

    @Override
    public MessageBean<?> exec(SessionFactory factory, UserInfoBean userInfo, RequestBean req) {
        try {
        PubUpInvoice pubUpInvoice = JsonUtils.objectToPojo(req.getData(), PubUpInvoice.class);
        PjPubUpInvoiceMapper pjPubUpInvoiceMapper= factory.getMapper(PjPubUpInvoiceMapper.class);
        // 1. updateTime,updateAccount,updateName
        pubUpInvoice.setUpdateInfo(userInfo);
        // 2. 更新数据
        pjPubUpInvoiceMapper.update(pubUpInvoice);
        // 3. 返回结果
        return MessageBean.create(Constant.MESSAGE_INT_SUCCESS,"工程报装单条数据更新成功",null);
        } catch (Exception e) {
            logger.error("工程报装单条数据更新失败",e);
            return MessageBean.create(Constant.MESSAGE_INT_FAIL,"工程报装单条数据更新失败",null);
        }
    }
}
